package server.business.entity;

import java.io.Serializable;

import com.alibaba.fastjson.JSON;

public class ResultMessage implements Serializable {

	private static final long serialVersionUID = 645768443043839734L;

	private boolean success;
	private Object message;

	public ResultMessage() {
		this(true);
	}

	public ResultMessage(boolean success) {
		this.success = success;
	}

	public ResultMessage(boolean success, Object message) {
		this.success = success;
		this.message = message;
	}

	public boolean isSuccess() {
		return success;
	}

	public void setSuccess(boolean success) {
		this.success = success;
	}

	public Object getMessage() {
		return (!success && message == null) ? "未知错误" : message;
	}

	public void setMessage(Object message) {
		this.message = message;
	}

	public String toJson() {
		return JSON.toJSONString(this);
	}

}
